{% extends "../theme/bage.html" %}
{% block headinfo %}
{% module use_f2e('codemirror') %}
<script>
    // 提交预约刷新的动作
    function chuli_kw() {
        $.ajaxSetup({cache: false});
        // 预约刷新
        // 模拟Form提交
        var myVAriable = $("#tags")[0].value;
        var stringArray = myVAriable.split(",");
        var out_str = ''
        var str_span = ''
        for (var str in stringArray) {
            if (stringArray[str] != '') {
                str_span = '<span class="btn btn-warning btn-xs">' + stringArray[str] + '<a onclick="del_kw(' + str + ');" style="color: #F00"> &times; </a></span>  '
            } else {
                str_span = ''
            }
            out_str += str_span
        }

        $('#kwlist').html(out_str);


    }

    function del_kw(str1) {
        $.ajaxSetup({cache: false});
        var myVAriable = $("#tags")[0].value;
        var stringArray = myVAriable.split(",");
        var out_str = ''
        var tag_str = ''
        var str_span = ''
        var tag_span = ''
        for (var str in stringArray) {
            if (str == str1) {
                str_span = ''
                tag_span = ''
            } else {
                if (stringArray[str] != '') {
                    str_span = '<span class="btn btn-warning btn-xs">' + stringArray[str] + '<a onclick="del_kw(' + str + ');" style="color: #F00"> &times; </a></span>  '
                    tag_span = stringArray[str] + ','
                } else {
                    str_span = ''
                    tag_span = ''
                }
            }


            out_str += str_span
            tag_str += tag_span
        }

        $('#kwlist').html(out_str);
        $("#tags")[0].value = tag_str;

    }

    chuli_kw();
</script>
{% end %}
{% block typebody %}
{% end %}





